package co.yixiang.huiMin.service.impl;

import co.yixiang.huiMin.entity.DriveTypes;
import co.yixiang.huiMin.mapper.DriveTypesMapper;
import co.yixiang.huiMin.service.DriveTypesService;
import co.yixiang.modules.shop.domain.DriverInfo;
import co.yixiang.modules.shop.service.mapper.DriverInfoMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 司机类型 服务实现类
 * </p>
 *
 * @author Author
 * @since 2020-07-31
 */
@Service
public class DriveTypesServiceImpl extends ServiceImpl<DriveTypesMapper, DriveTypes> implements DriveTypesService {

    @Resource
    private DriveTypesMapper driveTypesMapper;

    @Override
    public List<DriveTypes> selectDriveTypesAll() {
        QueryWrapper<DriveTypes> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("del_flag",0);
        return driveTypesMapper.selectList(queryWrapper);
    }

    @Override
    public int insetrDriveTypes(DriveTypes driveTypes) {
        driveTypes.setCreateTime(LocalDateTime.now());
        return driveTypesMapper.insert(driveTypes);
    }

    @Override
    public DriveTypes selectDriveTypesById(String id) {
        return driveTypesMapper.selectById(id);
    }

    @Override
    public int updateDriveTypes(DriveTypes driveTypes) {
        return driveTypesMapper.updateById(driveTypes);
    }
}
